Skip to content

feat: keep api console request errors recoverable - #33

Merged
jinbagi merged 1 commit into
masterfrom
codex/api-console-request-error-recovery
Jul 3, 2026
Merged

feat: keep api console request errors recoverable#33
jinbagi merged 1 commit into
masterfrom
codex/api-console-request-error-recovery

Conversation

@jinbagi

@jinbagi jinbagi commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep API Console request body validation failures visible inline instead of only showing transient toasts
  • include syntax/schema error details and recovery actions for formatting or resetting the request body template
  • clear stale request body errors when the user edits, changes method/resource/path, loads a resource, or restores a request
  • cover blocked pre-send request validation and recovery in API Console E2E

Verification

  • .\node_modules.bin\tsc.CMD -b --pretty false
  • .\node_modules.bin\eslint.CMD src/routes/raw_api/index.tsx src/routes/raw_api/index.module.css e2e/tests/api-console.spec.ts --max-warnings=0 --no-warn-ignored
  • E2E_TARGET_URL=http://127.0.0.1:55173/ui/ playwright test e2e/tests/api-console.spec.ts --config=.tmp-playwright-chrome.config.ts --project=chrome --reporter=list --workers=1
  • corepack pnpm lint
  • corepack pnpm build

Copilot AI review requested due to automatic review settings July 3, 2026 11:48
@jinbagi
jinbagi merged commit 957465a into master Jul 3, 2026
1 check passed
@jinbagi
jinbagi deleted the codex/api-console-request-error-recovery branch July 3, 2026 11:48

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 54bf24bd23

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +285 to +287
const requestBodyError = page.getByRole('alert').filter({
hasText: 'Resolve APISIX schema issues before sending.',
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Expect the malformed JSON alert text

This test fills the editor with {, but doExecute catches that in the JSON.parse block and renders the request-body alert with Fix request JSON before sending., returning before the APISIX schema feedback path can set Resolve APISIX schema issues before sending.. As written, the new E2E test will time out on this locator whenever it runs against the changed code; assert the JSON syntax error message here or use syntactically valid JSON that violates the schema.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the APISIX Dashboard API Console (“Raw API”) UX so request-body validation failures (JSON parse errors and Zod schema issues) stay visible inline with actionable recovery controls, rather than being only transient toasts.

Changes:

  • Adds an inline, persistent request-body error <Alert> with “Format JSON” and “Reset to template” recovery actions.
  • Clears stale request-body errors on relevant user actions (editing body, changing method/resource/path, loading/restoring requests, etc.).
  • Adds E2E coverage for “blocked before send” request validation + recovery flow.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/routes/raw_api/index.tsx Tracks request-body validation errors in state and renders a recoverable inline error alert with formatting/reset actions.
src/routes/raw_api/index.module.css Adds spacing for the new request-body error alert.
e2e/tests/api-console.spec.ts Adds an E2E test to ensure blocked request validation errors remain visible and can be recovered via reset.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1046 to +1048
{requestBodyError.details.slice(0, 5).map((detail) => (
<li key={detail}>{detail}</li>
))}
Comment on lines +277 to +287
await uiFillMonacoEditor(page, requestEditor, '{');

await page.getByRole('button', { name: /Send PUT/ }).click();
await page
.getByRole('dialog', { name: `PUT /routes/${routeId}` })
.getByRole('button', { name: 'Execute' })
.click();

const requestBodyError = page.getByRole('alert').filter({
hasText: 'Resolve APISIX schema issues before sending.',
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants